]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
system: Only show rotation lock when a builtin output is present
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 20 Apr 2016 18:26:49 +0000 (20:26 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 21 Apr 2016 19:16:50 +0000 (21:16 +0200)
We currently show the orientation lock button when an accelerometer
is present, however gnome-settings-daemon's xrandr plugin only applies
rotation when a builtin monitor is present. Update the button's
visibility to match gnome-settings-daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=765267

js/ui/status/system.js

index fb0b04037417b31abf984ac1f50c90296c06107d..4981d948b65ec53fd854a0f8e35ac2e14340c8e5 100644 (file)
@@ -6,6 +6,7 @@ const Gdm = imports.gi.Gdm;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const Lang = imports.lang;
+const Meta = imports.gi.Meta;
 const Shell = imports.gi.Shell;
 const St = imports.gi.St;
 
@@ -110,6 +111,7 @@ const Indicator = new Lang.Class({
 
         this._session = new GnomeSession.SessionManager();
         this._loginManager = LoginManager.getLoginManager();
+        this._monitorManager = Meta.MonitorManager.get();
         this._haveShutdown = true;
         this._haveSuspend = true;
 
@@ -155,6 +157,8 @@ const Indicator = new Lang.Class({
 
         this._orientationSettings.connect('changed::orientation-lock',
                                           Lang.bind(this, this._updateOrientationLock));
+        Main.layoutManager.connect('monitors-changed',
+                                   Lang.bind(this, this._updateOrientationLock));
         Gio.DBus.system.watch_name(SENSOR_BUS_NAME,
                                    Gio.BusNameWatcherFlags.NONE,
                                    Lang.bind(this, this._sensorProxyAppeared),
@@ -264,7 +268,8 @@ const Indicator = new Lang.Class({
 
     _updateOrientationLock: function() {
         if (this._sensorProxy)
-            this._orientationLockAction.visible = this._sensorProxy.HasAccelerometer;
+            this._orientationLockAction.visible = this._sensorProxy.HasAccelerometer &&
+                                                  this._monitorManager.get_is_builtin_display_on();
         else
             this._orientationLockAction.visible = false;